class CreateMatriculas < ActiveRecord::Migration
  def self.up
    create_table :matriculas do |t|
      t.references :usuario
      t.references :disciplina
      t.decimal :nota, :limit => 5, :null => false
      t.string :descricao, :limit => 100, :null => false
     

      t.timestamps
    end
    execute("alter table matriculas add foreign key (usuario_id) references usuarios(id)")
    execute("alter table matriculas add foreign key (disciplina_id) references disciplinas(id)")
  end

  def self.down
    drop_table :matriculas
  end
end
